package com.zqx.memento.originalAndMementoAndCaretaker;


import lombok.Getter;
import lombok.Setter;

/**
 * description: 原发器
 * @author zqx
 * @date 2018/09/04
 */
@Setter
@Getter
public class Chessman {

    private String label;
    private int x;
    private int y;

    public Chessman(String label, int x, int y) {
        this.label = label;
        this.x = x;
        this.y = y;
    }

    //保存状态
    public ChessmanMemento save(){
        return new ChessmanMemento(this.label,this.x,this.y);
    }

    //恢复状态
    public void restore(ChessmanMemento memento){
        this.label = memento.getLabel();
        this.x = memento.getX();
        this.y = memento.getY();
    }
}
